package com.liuzhilong.infrastructure.basic.command.simple;

import lombok.AccessLevel;
import lombok.Setter;
import lombok.experimental.Accessors;

@Setter(AccessLevel.PRIVATE)
@Accessors(chain = true)
public class TwoCommand implements Command {

    private TwoReceiver twoReceiver;

    @Override
    public void execute() {
        System.out.println(this.getClass().getName()+" 先执行TwoReceiver的doSometing");
        twoReceiver.doSometing();
        System.out.println(this.getClass().getName()+" 再执行TwoReceiver的doLast");
        System.out.println(twoReceiver.doLast());
    }

    public static final TwoCommand create(TwoReceiver twoReceiver){
        return new TwoCommand().setTwoReceiver(twoReceiver);
    }
}
